<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
	<c:set var="ctx" value="${pageContext.request.contextPath}" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>产品详情</title>
	<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<form id="formSet1">
		<table class="layout2col1">
			<tbody>
			<tr>
				<td id="prdTypTD" width="20%" valign="top">
					<div class="sqPanel">
						<div class="sqPanel_head">
							<div class="label">产品类型</div>
						</div>
						<div class="sqPanel_body" style="min-height: 300px;">
							<ul id="tree1"></ul>
						</div>
					</div>
				</td>
				<td valign="top">
					<div class="fieldset1 tabel_col clearFix">
						<div class="caption">
							<span class="title">产品信息</span>
						</div>
						<div class="fieldBox col_33">
							<div class="label">产品名称</div>
							<div class="field">
								<span name="prdNm" id="prdNm">&nbsp;</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">产品型号</div>
							<div class="field">
								<span name="prdMdl" id="prdMdl">&nbsp;</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">产品类型</span></div>
							<div class="field">
								<span name="prdTypCdNm" id="prdTypCdNm">&nbsp;</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">产品品牌</span></div>
							<div class="field">
								<span name="brCdNm" id="brCdNm">&nbsp;</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">建议价格</div>
							<div class="field">
								<span name="guidePcDouble" id="guidePcDouble">&nbsp;</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">设备状态 (是否启用)</div>
							<div class="field">
								<span name="isValidNm" id="isValidNm">&nbsp;</span>
							</div>
						</div>
						<div id="mfrDiv" class="fieldBox col_33">
							<div class="label">厂商</span></div>
							<div class="field">
								<span name="mfrNm" id="mfrNm">&nbsp;</span>
							</div>
						</div>
						<div id="dyncBizdiv">
							<%-- <jsp:include page="prdBscInfoDetailDynamicPage.jsp"></jsp:include> --%>
						</div>
						<div class="fieldBox col_100">
							<div class="label">备注</div>
							<div class="field">
								<span name="prdRem" id="prdRem">&nbsp;</span>
								<input name="pId" id="pId" type="hidden" value="${id }">
							</div>
						</div>
					</div>
				</td>
			</tr>
			</tbody>
		</table>
	</form>
	<div class="fieldset1 tabel_col clearFix" id="dyncTkListdiv">
		<div class="caption">
			<span class="title">产品详细列表</span>
		</div>
		<div class="fieldBox col_100">
			<jsp:include page="../prdTkInfo/prdTkInfoDetailList.jsp"></jsp:include>
		</div>
	</div>
	<div class="fieldset1 tabel_col clearFix" id="dyncTkBusListdiv">
		<div class="caption">
			<span class="title">产品详细列表</span>
		</div>
		<div class="fieldBox col_100_auto">
			<jsp:include page="../prdTkBusInfo/prdTkBusInfoDetailList.jsp"></jsp:include>
		</div>
	</div>
</div>
</body>

<script type="text/javascript">
    var selectData,prdData,_prdCd;

    var _prdId="${id }";

    var _bizTypCd;	//目标代码组值
    var _bizCd;	//目标代码值
    var _sGrpCd;	//源代码组值
    var _sCode;//源代码值

    var wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });

    $(function () {
        var form = $("#formSet1").ligerForm({
            validate: true
        });

        //产品类型树
        tree = $("#tree1").ligerTree({
            url: '<%=path%>/product/prdBscInfo/getPrdTyeData.do',
            ajaxType: 'get',
            checkbox: false,
            isExpand: false,
            parentIcon: "SqFolder",
            childIcon: "SqLeaf",
            textFieldName:"tName",
            idFieldName:"tCode",
            onSelect: onSelectTree,
            onSuccess:function(data){
                if(selectData){
                    tree.selectNode(selectData);
                }
            }
        });
        initData();
    })

    function initData(){
        var id = $("#pId").val();
        if(!id){
            //chahgeItemStatus(true);
            return;
        }
        $("#prdTypTD").hide();//隐藏树
        //parent.pageInApp.spl_id = id;
        var _url = '<%=path%>/product/prdBscInfo/getById.do';
        $.ajax({
            type: 'get',
            dataType:'json',
            data:{id:id},
            url: _url,
            success:function(msg){
                if(msg.success == 1){
                    //根据产品类型  设置选中树
                    selectData = msg.data.prdTypCd;
                    if(tree){
                        tree.selectNode(selectData);
                    }
                    prdData = msg.data;
                    setData(msg.data);//设置数据
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }
    //设置固定字段数据	
    function setData(data){
        $("#prdNm").html(data.prdNm);
        $("#prdMdl").html(data.prdMdl);
        $("#prdTypCdNm").html(data.prdTypCdNm);
        $("#mfrNm").html(data.mfrNm);
        $("#brCdNm").html(data.brCdNm);
        $("#isValidNm").html(data.isValidNm);
        $("#guidePcDouble").html(data.guidePcDouble);
        $("#prdRem").html(data.prdRem);
    }
    //设置动态字段数据
    function setOthData(data){
        $("#prdClsCdNm").html(data.prdClsCdNm);
        var prdCarInfoVO = data.prdCarInfoVO;
        if(prdCarInfoVO){
            $("#prdSeries").html(prdCarInfoVO.prdSeries);
            $("#carLen").html(prdCarInfoVO.carLen);
            $("#prdLvlCdNm").html(prdCarInfoVO.prdLvlCdNm);
            $("#prdYr").html(prdCarInfoVO.prdYr);
            $("#outVol").html(prdCarInfoVO.outVol);
            $("#grboxCfg").html(prdCarInfoVO.grboxCfg);
            $("#engMdl").html(prdCarInfoVO.engMdl);
            $("#carStrcCfg").html(prdCarInfoVO.carStrcCfg);
            $("#carCl").html(prdCarInfoVO.carCl);
            $("#maxSpd").html(prdCarInfoVO.maxSpd);
            $("#carMdl").html(prdCarInfoVO.carMdl);
            $("#othCfg").html(prdCarInfoVO.othCfg);
            $("#prdCyCdNm").html(prdCarInfoVO.prdCyCdNm);
            $("#grboxTypCdNm").html(prdCarInfoVO.grboxTypCdNm);
            $("#seatQtyCdNm").html(prdCarInfoVO.seatQtyCd);
            $("#drvTypCdNm").html(prdCarInfoVO.drvTypCdNm);
            $("#carStrcCdNm").html(prdCarInfoVO.carStrcCdNm);
            $("#powerTypCdNm").html(prdCarInfoVO.powerTypCdNm);
            $("#prdWayCdNm").html(prdCarInfoVO.prdWayCdNm);
            $("#emiStdCd").html(prdCarInfoVO.emiStdCd);
            $("#batDeg").html(prdCarInfoVO.batDeg);
            $("#extMil").html(prdCarInfoVO.extMil);
            $("#carVol").html(prdCarInfoVO.carVol);

            $("#seatQtyCd").html(prdCarInfoVO.seatQtyCd);
            $("#carStrcCfgNm").html(prdCarInfoVO.carStrcCfgNm);
            $("#powerTypCd").html(prdCarInfoVO.powerTypCd);
        }
    }

    var _prdTypCd;//产品类型

    function onSelectTree (node) {
        //alert(node.data.sGrpCd);alert(node.data.sCode);alert(node.data.tGrpCd);alert(node.data.tCode);alert(node.data.tName);
        //return;
        if(node.data.children){
            $.ligerDialog.SQalert({content: LogUtils.LOG_PRD_CHECK_PRD_TYPE , SQ_type: "warning" });
            return;
        }
        _prdCd = node.data.tCode;
        _prdTypCd = node.data.tCode;
        //刷新字段组件
        _bizTypCd = node.data.tGrpCd;	//目标代码组值
        _bizCd = node.data.tCode;	//目标代码值
        _sGrpCd = node.data.sGrpCd;	//源代码组值
        _sCode = node.data.sCode;	//源代码值

        _bizCd = _bizCd.substring(0,3);//产品动态字段根据一级产品类型刷新即可

        var _prdTypCdNm = node.data.tName;	//目标代码名

        var _pTypNm;
        var pNode = tree.getParent(node, 1);
        if(pNode){
            _pTypNm = pNode.tName;	//父节点名
        }

        var _url = '<%=path%>/product/prdBscInfo/toPrdDynamicFldDetailPage.do';
        //刷新动态组件

        $("#dyncBizdiv").load(_url,{bizTypCd:_bizTypCd, bizCd:_bizCd, prdTypCd:_prdTypCd, prdTypCdNm:_prdTypCdNm, pTypNm:_pTypNm},function(responseText,textStatus){
            dynamicBizPageUIInst();
            setOthData(prdData);//加载完动态组件 为动态组件设置值
            wait_dialog.close();

        });

    }
</script>